package com.example.demo.struct.flyweight;

import java.awt.Color;

/**
 * @Desc:
 * @Author zzz
 * @Date 2021/2/24
 * @Version V1.0
 */
public class FlyweightTest {
    public static void main(String[] args) {
        WuziqiFactory wuziqiFactory = new WuziqiFactory();

        Wuziqi white1 = wuziqiFactory.getQizi(Color.WHITE);
        Wuziqi white2 = wuziqiFactory.getQizi(Color.WHITE);
        System.out.println(white1);
        System.out.println(white2);

        Wuziqi black1 = wuziqiFactory.getQizi(Color.BLACK);
        Wuziqi black2 = wuziqiFactory.getQizi(Color.BLACK);
        Wuziqi black3 = wuziqiFactory.getQizi(Color.BLACK);
        System.out.println(black1);
        System.out.println(black2);
        System.out.println(black3);
    }
}
